import { DefaultSetting } from './default_setting';
import { getProxy } from './proxy';

const base = '/';
const proxyUrl = 'http://localhost:10066';
const requestApi = '/api-test';

const constant = {
  ...DefaultSetting,
  base: base,
  proxyUrl: proxyUrl,
  publicPath: base,
  api: requestApi,
  primaryColor: '#5A9DFE',
};

const proxy = getProxy({
  api: requestApi,
  target: proxyUrl,
  changeOrigin: true,
  pathRewrite: { '^': '' },
  ws: true,
});

export default {
  base: constant.publicPath,
  publicPath: constant.publicPath,
  title: constant.projectName,
  define: {
    'process.env': {
      Constant: constant,
      UMI_ENV: 'dev',
    },
  },
  proxy: proxy,
  theme: {
    'primary-color': constant.primaryColor,
  },
};
